<?php

namespace App\Http\Validate\OpenShop\SiteLocation;

use App\Http\Validate\BaseValidate;

/**
 * [ 提交选址 ] - 校验规则
 *
 * @ProductAnalysisValidate
 * @package App\Http\Controllers
 * @date 2022/04/26 02:35:56
 * @author huang
 */
class ProductAnalysisValidate extends BaseValidate
{


    static function registerValidateRules(): void
    {
        // TODO: Implement registerValidateRules() method.
    }

    static function getRules(array $fields = []): array
    {
        return [
            "id"                          => '',
            'type'                        => '',
            'productName'                 => '',
            'hallFoodNumber'              => '',
            'hallFoodUnitPrice'           => '',
            'elemNumber'                  => '',
            'elemUnitPrice'               => '',
            'meituanNumber'               => '',
            'meituanUnitPrice'            => '',
            'shopInnerPhoto'              => 'array',
            'dazhongPhoto'                => 'array',
            'elemPhoto'                   => 'array',
            'meituanPhoto'                => 'array',
            'eatInOpenReceiptPhoto'       => 'array',
            'eatInGraduationReceiptPhoto' => 'array',
            'specialExplanation'          => ""
        ];
    }

    public static array $attributes = [
        "id"                          => '主键Id',
        'type'                        => '类型',
        'productName'                 => '名称',
        'elemNumber'                  => '饿了么销量',
        'elemUnitPrice'               => '饿了么客单价',
        'meituanNumber'               => '美团销量',
        'meituanUnitPrice'            => '美团客单价',
        'shopInnerPhoto'              => '店内图片',
        'dazhongPhoto'                => '大众点评截图',
        'elemPhoto'                   => '饿了么截图',
        'meituanPhoto'                => '美团截图',
        'eatInGraduationReceiptPhoto' => '堂食结业小票',
        'specialExplanation'          => '外卖等特殊情况说明',
    ];


    public static function handelData(array $requestParams)
    {
        $data = [];
        foreach ($requestParams['productAnalysis'] as $value) {
            $data[] = self::submitValidate($value);
        }
        return $data;
    }

    public static function submitValidate(array $requestParams): array
    {
        return self::baseValidate(
            $requestParams,
            array_keys(self::getRules()),
            null,
            null,
            self::getValidateMsg()
        );
    }


}
